import request from './request'

export const list = (data) => {
  return request({
    url: '/role/list',
    method: 'POST',
    data
  })
}

export const save = (data) => {
  return request({
    url: '/role/save',
    method: 'POST',
    data
  })
}

export const modify = (data) => {
  return request({
    url: '/role/modify',
    method: 'POST',
    data
  })
}

export const remove = (id) => {
  return request({
    url: '/role/remove?ids=' + id,
    method: 'GET'
  })
}

// 查询权限列表
export const listPermission = () => {
  return request({
    url: '/role/listPermission',
    method: 'GET'
  })
}

// 查询当前角色已有权限
export const listPermissionByRoleId = (data) => {
  return request({
    url: '/role/listPermissionByRoleId/' + data,
    method: 'GET'
  })
}

// 添加权限
export const savePermission = (data) => {
  return request({
    url: '/role/savePermission',
    method: 'POST',
    data
  })
}

export const listAll = (data) => {
  return request({
    url: '/role/listAll',
    method: 'POST',
    data
  })
}
